package org.xukai.rest.common;

import com.alibaba.fastjson.serializer.ValueFilter;

import java.util.HashSet;
import java.util.Set;

/**
 * @author xukai
 * @desc
 * @date 2017-04-10-18:40
 */
public class LongValueFilter implements ValueFilter {

    Set<String> stringSet = new HashSet<String>();

    public LongValueFilter() {
        super();
        stringSet.add("sysTid");
        stringSet.add("sysTradeId");
        stringSet.add("sysOrderId");
        stringSet.add("sysPayId");
        stringSet.add("sysTemId");
        stringSet.add("sysTempId");
        stringSet.add("oid");
        stringSet.add("tid");
        stringSet.add("sourceTid");
        stringSet.add("source_oid");
        stringSet.add("couponId");
    }


    @Override
    public Object process(Object object, String name, Object value) {
        if (stringSet.contains(name)) {
            return "" + value;
        }
        return value;
    }


    public static void main(String[] args) {
//        SysTrade sysTrade = new SysTrade();
//        sysTrade.setSysTradeId(111111L);
//        String text = JSON.toJSONString(sysTrade, new SerializeFilter[]{
//                new LongValueFilter()
//        });

        System.out.println("");
    }

}
